home *** CD-ROM | disk | FTP | other *** search
/ Network Supervisor's Toolkit / Network Supervisor's Toolkit.iso / tools / nwtp06 / logcon.pas < prev    next >
Pascal/Delphi Source File  |  1996-07-10  |  3KB  |  81 lines

  1. {$X+,V-,B-}
  2. program LogCon;
  3.  
  4. { Example program for the nwConn unit/ NwTP 0.6 API. (c) 1993,1995, R.Spronk }
  5.  
  6. { Shows the use of the GetObjectLoginControl Function. }
  7.  
  8. uses nwMisc,nwConn;
  9.  
  10. CONST TestObjName='TEST';
  11.       { name of the object whose LOGIN_CONTROL property is read. }
  12.       { must be of objecttype 'ot_user' }
  13.  
  14. Var li:TloginControl;
  15.     s :string;
  16.  
  17. {
  18.      BadLoginCount             :byte;
  19.      AccountResetTime          :TnovTime;  dmy, hms valid only
  20.      LastIntruderAdress        :TinterNetworkAdress;
  21.  
  22.      MaxConcurrentConnections  :byte;
  23.      LoginTimes                :array[1..42] of byte;
  24.  
  25.      unknown1                  :byte;
  26.      unknown2                  :array[1..6] of byte;
  27. }
  28.  
  29. begin
  30. IF NOT GetObjectLoginControl('TEST',1,li)
  31.  then begin
  32.       writeln('GetObjectLoginControl Failed. error#',nwConn.result);
  33.       writeln;
  34.       writeln('(Hint: change the hardcoded username in the source to a username that exists.)');
  35.       halt(1);
  36.       end;
  37.  
  38. writeln('Logincontrol Information:');
  39. writeln;
  40. if li.AccountDisabled then writeln('The account is DISABLED.');
  41.  
  42. NovTime2String(li.AccountExpirationDate,s);delete(s,1,5);
  43. if pos('lid date &',s)>0 then s:='No expiration date set.';
  44. writeln('Account Expires: ',s);
  45.  
  46. writeln;
  47. writeln('Minimum Password length =',li.MinimumPasswordLength);
  48. writeln('Days between password changes =',li.DaysBetweenPasswordChanges);
  49.  
  50. NovTime2String(li.PasswordExpirationDate,s);delete(s,1,5);
  51. if pos('lid date &',s)>0 then s:='No Expiration date set.';
  52. writeln('Password Expiration date: ',s);
  53.  
  54. write('Password control flag: ');
  55. CASE li.PasswordControlFlag of
  56.  0:writeln('User is allowed to change password.');
  57.  1:writeln('Supervisor must change password.');
  58.  2:writeln('User is allowed to change password. Passwords must be unique.');
  59.  3:writeln('Supervisor must change passwords. Passwords must be unique.');
  60.  else writeln('Unknown Password control Flag:',li.PasswordControlFlag);
  61. end; {case}
  62.  
  63. writeln;
  64. IF li.MaxGraceLoginsAllowed=0
  65.  then writeln('Grace logins are unlimited.')
  66.  else begin
  67.       writeln('Max. Grace Logins: ',li.MaxGraceLoginsAllowed);
  68.       writeln('Remaining Grace Logins: ',li.GraceLoginsRemaining);
  69.       end;
  70. writeln;
  71.  
  72. NovTime2String(li.LastLoginTime,s);delete(s,1,5);
  73. if pos('lid date &',s)>0 then s:='Object has never logged in.';
  74. writeln('Last login time: ',s);
  75.  
  76. writeln;
  77. NovTime2String(li.AccountResetTime,s);delete(s,1,5);
  78. if pos('lid date &',s)>0 then s:='?? time not set.';
  79. writeln('Date of last Account reset: ',s);
  80.  
  81. end.